<html>
    <head>
        <title>Test</title>
        <style>
          plaintext { display:block; size:*; border:1dip solid;}
          plaintext > text.error {  background: pink; }
          plaintext:busy {
            foreground: url(sciter:busy.png) no-repeat 100% 0%;
            foreground-size: 16dip;
          }
        </style>
        <script type="text/tiscript">
          event click $(#exec) {
            var out = $(plaintext);

            const EOL = System.EOL;

            var cline;
            var lt = null;

            function append(text, from) {
              var lines = text.split(EOL);
              if( from !== lt ) {
                out.$append(<text.{from}>{ lines.shift() }</text>);
                cline = out.last;
              }
              else
                cline.append(lines.shift());
              for(var line in lines) {
                out.$append(<text.{from}>{ line }</text>);
                cline = out.last;
              }
              lt = from;
            }

            var cmd = System.PLATFORM == #Windows ? "tracert" : "traceroute";

            var childProc = System.Process.exec(cmd, ["sciter.com"]);

            childProc  << event stdout (text) { append(text,#out) }
                       << event stderr (text) { append(text,#error) }
                       << event terminate (status) { 
                            out.$append(<text.done>Done:{status.toString()}</text>); 
                            out.state.busy = false;
                          };

            out.state.busy = true;
          }

        </script>
    </head>
    <body>

      <button #exec>Show trace route</button>

      <plaintext></plaintext>


    </body>
</html>